package com.cetc.nsfx.util.interceptor;

import org.apache.log4j.Logger;

/**
 *@Author: zhaocy
 *@Email : zhaocy@ecdatainfo.com
 *@Date  : 2012-3-31
 *@Desc  :
 */
public class OracleDialect implements Dialect {

	@Override
	public String getQuerySQL(String sql, int offset, int limit) {
		sql = sql.trim();  
        StringBuffer pagingSelect = new StringBuffer(sql.length() + 100);  
        pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");  
        pagingSelect.append(sql);  
        pagingSelect.append(" ) row_ ) where rownum_ > ").append(offset).append(" and rownum_ <= ").append(offset + limit);
        return pagingSelect.toString();
	}

}
